package org.practice.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateSessionFactory {
	private static Configuration config;
	private static SessionFactory session;
	static {
		System.out.println("==hibernate 加载映射文件==");
		config=new Configuration().configure();
		session=config.buildSessionFactory();
	}
	
	public static Session openSession(){
		return session.openSession();
	}
	public static void closeSession(){
		session.close();
	}
}
